﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Class.aspx.cs" Inherits="_Class" MasterPageFile="~/MasterPage.master"%>


<asp:Content runat="server" ContentPlaceHolderID="Main">

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    
    <table>
    <tr>
    <td align="right" class="style2">
    </td>
    </tr>
    <tr><td><div class="style1" style="position:relative; left:0px; top:0px; text-align:center;">&nbsp;<asp:Label ID="TitleLabel" runat="server" 
            Text="CS 4960"></asp:Label>
        </div></td>
    </tr>
    </table>
    
    <h3>Conversations:
    </h3>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <table><tr><td>
    <asp:GridView ID="GridView1" runat="server"
        AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
        DataSourceID="ObjectDataSource1"
            onselectedindexchanged="GridView1_SelectedIndexChanged"
            onselectedindexchanging="GridView1_SelectedIndexChanging" CellPadding="4" 
            ForeColor="#333333" GridLines="None">
        <FooterStyle BackColor="#660000" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
            <asp:CommandField SelectText="View" ShowSelectButton="True" />
            <asp:BoundField DataField="Subject" HeaderText="Subject" 
                SortExpression="Subject" />
            <asp:BoundField DataField="Username" HeaderText="Username" 
                SortExpression="Username" />
            <asp:BoundField DataField="Class" HeaderText="Class" 
                SortExpression="Class" />
            <asp:BoundField DataField="Date" HeaderText="Date" 
                SortExpression="Date" />
            <asp:TemplateField HeaderText="Id" InsertVisible="False" SortExpression="Id" 
                Visible="False">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Post" HeaderText="Post" SortExpression="Post" 
                Visible="False" />
            <asp:BoundField DataField="ReplyId" HeaderText="ReplyId" 
                SortExpression="ReplyId" Visible="False" />
        </Columns>
        <PagerStyle BackColor="#660000" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#660000" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
    
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetAllPostsByClass" 
        TypeName="DataSetTableAdapters.PostsByClassTableAdapter" 
        onselecting="ObjectDataSource1_Selecting">
        <SelectParameters>
            <asp:CookieParameter CookieName="classname" DefaultValue="cs4960" 
                Name="classname" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </td></tr>
    <tr align=right><td>
    <asp:LoginView ID="LoginView3" runat="server"><LoggedInTemplate>
        <!--<asp:HyperLink ID="submitPost" runat="server" Font-Underline="True" ToolTip="Add a post" NavigateUrl="submit.aspx?action=post&name=">Add a post</asp:HyperLink> <br />-->
        <asp:Button ID="submitPostButton" runat="server" Text="add a post" onclick="submitPostButton_Click" />
    </LoggedInTemplate>
        <AnonymousTemplate>
            <br />
        </AnonymousTemplate>
        </asp:LoginView>
    <br />
    </td></tr>
    <tr align="left"><td>
      
        <asp:DetailsView ID="DetailsView2" runat="server" AllowPaging="True" 
            AutoGenerateRows="False" CellPadding="4" DataSourceID="ObjectDataSource4" 
            ForeColor="#333333" GridLines="None" Visible="False" >
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
            <PagerStyle BackColor="#660000" ForeColor="White" HorizontalAlign="Center" />
            <Fields>
                <asp:BoundField DataField="Username" HeaderText="Username" 
                    SortExpression="Username" />
                <asp:BoundField DataField="Subject" HeaderText="Subject" 
                    SortExpression="Subject" />
                <asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class" />
                <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
                <asp:BoundField DataField="Post" HeaderText="Post" SortExpression="Post">
                <ControlStyle Height="100px" Width="1000px" />
                <ItemStyle Height="100px" Width="500px" />
                </asp:BoundField>
                <asp:BoundField DataField="ReplyId" HeaderText="ReplyId" 
                    SortExpression="ReplyId" Visible="False" />
                <asp:TemplateField HeaderText="Id" InsertVisible="False" SortExpression="Id" 
                    Visible="False">
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Fields>
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:DetailsView>
        <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" 
            InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="GetPostsAndReplysById" 
            TypeName="DataSetTableAdapters.GetConversationThreadTableAdapter">
            <SelectParameters>
                <asp:ControlParameter ControlID="IDlabel" DefaultValue="0" Name="id" 
                    PropertyName="Text" Type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="Username" Type="String" />
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Class" Type="String" />
                <asp:Parameter Name="Post" Type="String" />
                <asp:Parameter Name="Date" Type="DateTime" />
                <asp:Parameter Name="ReplyId" Type="Int32" />
            </InsertParameters>
        </asp:ObjectDataSource>
    </td></tr>
    <tr align=right><td>
        <asp:Label ID="IDlabel" runat="server" Text="Label" Visible="False"></asp:Label>
        </td></tr>
    </table>
    <asp:Button ID="replyButton" runat="server" Text="Reply" 
        onclick="replyButton_Click" />
    <asp:Button ID="deleteButton" runat="server" Text="Delete Post" 
        onclick="deleteButton_Click" />
       </ContentTemplate>
    </asp:UpdatePanel>
    <br />
    <br />
    <br />
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
    <h3>Evaluations:<br />
    </h3>
    <table>
    </p>
    
        <caption>
            <p>
            </p>
            <tr>
                <td>
                    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
                        CssClass="style3" DataSourceID="ObjectDataSource2" ForeColor="#333333" 
                        GridLines="None" onselectedindexchanging="GridView2_SelectedIndexChanging">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <Columns>
                            <asp:CommandField SelectText="View" ShowSelectButton="True" />
                            <asp:BoundField DataField="Username" HeaderText="Username" 
                                SortExpression="Username" />
                            <asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class" />
                            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
                            <asp:TemplateField HeaderText="Id" InsertVisible="False" SortExpression="Id" 
                                Visible="False">
                                <EditItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Post" HeaderText="Post" SortExpression="Post" 
                                Visible="False" />
                        </Columns>
                        <PagerStyle BackColor="#660000" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#660000" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#999999" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
                        InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
                        SelectMethod="GetReviewsByClass" 
                        TypeName="DataSetTableAdapters.ReviewByClassTableAdapter">
                        <SelectParameters>
                            <asp:CookieParameter CookieName="classname" DefaultValue="cs4960" 
                                Name="classname" Type="String" />
                        </SelectParameters>
                        <InsertParameters>
                            <asp:Parameter Name="Username" Type="String" />
                            <asp:Parameter Name="Class" Type="String" />
                            <asp:Parameter Name="Date" Type="DateTime" />
                            <asp:Parameter Name="Post" Type="String" />
                        </InsertParameters>
                    </asp:ObjectDataSource>
                </td>
            </tr>
            <caption>
                <p>
                </p>
                <caption>
                    <p>
                    </p>
                    <tr align="right">
                        <td>
                            <asp:LoginView ID="LoginView2" runat="server">
                                <LoggedInTemplate>
                                    <!--<asp:HyperLink ID="submitEval" runat="server" Font-Underline="True" ToolTip="Add an evaluation" NavigateUrl="submit.aspx?action=eval&name=">Add an evaluation</asp:HyperLink> -->
                                    <asp:Button ID="submitEvalButton" runat="server" 
                                        onclick="submitEvalButton_Click" Text="add an evaluation" />
                                    <p>
                                    </p>
                                </LoggedInTemplate>
                            </asp:LoginView>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <b>
                            <asp:Label ID="EvalLabel" runat="server" Text="Label" Visible="False"></asp:Label>
                            <br />
                            <br />
                            </b>
                            <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" 
                                CellPadding="4" CssClass="style3" DataSourceID="ObjectDataSource5" 
                                ForeColor="#333333" GridLines="None" Visible="False" Width="500px">
                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <Columns>
                                    <asp:BoundField DataField="Username" HeaderText="Username" 
                                        SortExpression="Username" Visible="False" />
                                    <asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class" 
                                        Visible="False" />
                                    <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" 
                                        Visible="False" />
                                    <asp:BoundField DataField="Post" HeaderText="Post" SortExpression="Post">
                                        <ItemStyle Height="100px" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                                        ReadOnly="True" SortExpression="Id" Visible="False" />
                                </Columns>
                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#660000" Font-Bold="True" ForeColor="White" />
                                <EditRowStyle BackColor="#999999" />
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                            </asp:GridView>
                            <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" 
                                InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
                                SelectMethod="GetReviewById" 
                                TypeName="DataSetTableAdapters.GetEvaluationTableAdapter">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="EvalLabel" DefaultValue="0" Name="id" 
                                        PropertyName="Text" Type="Int32" />
                                </SelectParameters>
                                <InsertParameters>
                                    <asp:Parameter Name="Username" Type="String" />
                                    <asp:Parameter Name="Class" Type="String" />
                                    <asp:Parameter Name="Date" Type="DateTime" />
                                    <asp:Parameter Name="Post" Type="String" />
                                </InsertParameters>
                            </asp:ObjectDataSource>
                            <br />
                            <asp:Button ID="evalDeleteButton" runat="server" onclick="deleteEvalButton_Click" 
                                Text="Delete Evaluation" Visible="False" />
                        </td>
                    </tr>
                </caption>
            </caption>
        </caption>
    </table>
     </ContentTemplate>
    </asp:UpdatePanel>
    <p>
        &nbsp;<asp:UpdatePanel ID="UpdatePanel3" runat="server">
    <ContentTemplate>
        <b>Class Score</b> (Ranked from 1 to 10, except for homework hours per week):
    <table title="wrapScoreTable">
    <tr><td>
        <table border="2" title="ScoreTable">
        <tr><td>Description</td><td>Mean Score</td><td><asp:LoginView ID="LoginView5" runat="server"><LoggedInTemplate>My Score</LoggedInTemplate></asp:LoginView></td></tr>
        <tr><td>Homework hours per Week</td><td><asp:Label ID="Label0" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myHours" runat="server"></asp:TextBox></td></tr>
        <tr><td>Difficulty (10 = Hard)</td><td><asp:Label ID="Label1" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myDifficulty" runat="server"></asp:TextBox></td></tr>
        <tr><td>Professor</td><td><asp:Label ID="Label2" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myProfessor" runat="server"></asp:TextBox></td></tr>
        <tr><td>Text Book Usefulness</td><td><asp:Label ID="Label3" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myBook" runat="server"></asp:TextBox></td></tr>
        <tr><td>Lecture Usefulness</td><td><asp:Label ID="Label4" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myLecture" runat="server"></asp:TextBox></td></tr>
        <tr><td>Importance of the Class</td><td><asp:Label ID="Label5" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myMaterial" runat="server"></asp:TextBox></td></tr>
        <tr><td>Fun Factor</td><td><asp:Label ID="Label6" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myFun" runat="server"></asp:TextBox></td></tr>
        <tr><td>Overall</td><td><asp:Label ID="Label7" runat="server" Text="3.8"></asp:Label></td><td><asp:TextBox ID="myOverall" runat="server"></asp:TextBox></td></tr>
        </table>
    </td></tr>
    <tr>
    <td align="right"> <asp:Label ID="ScoreMessage" runat="server" Text="" style="color: #CC0000"></asp:Label>
        <asp:LoginView ID="LoginView4" runat="server"><LoggedInTemplate>
            <!--<asp:HyperLink ID="changeMyScore" runat="server" Font-Underline="True" ToolTip="change My Score" NavigateUrl="">update My Score</asp:HyperLink>-->
           <asp:Button ID="ChangeMyScoreButton" runat="server" Text="change My Score" 
            onclick="ChangeMyScoreButton_Click" />
          </LoggedInTemplate></asp:LoginView>
    </td></tr>
    </table>
    <br />
    <div id="link">
    <asp:HyperLink ID="return" runat="server"
            ToolTip="Return to the index" NavigateUrl="index.aspx">Back to the index</asp:HyperLink>
            </div>
    <p/>
        &nbsp;
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            DataSourceID="ObjectDataSource3" Height="50px" Visible="False" Width="125px">
            <Fields>
                <asp:BoundField DataField="HWaverage" HeaderText="HWaverage" ReadOnly="True" 
                    SortExpression="HWaverage" />
                <asp:BoundField DataField="Diffaverage" HeaderText="Diffaverage" 
                    ReadOnly="True" SortExpression="Diffaverage" />
                <asp:BoundField DataField="Profaverage" HeaderText="Profaverage" 
                    ReadOnly="True" SortExpression="Profaverage" />
                <asp:BoundField DataField="Textaverage" HeaderText="Textaverage" 
                    ReadOnly="True" SortExpression="Textaverage" />
                <asp:BoundField DataField="Lecaverage" HeaderText="Lecaverage" ReadOnly="True" 
                    SortExpression="Lecaverage" />
                <asp:BoundField DataField="Importaverage" HeaderText="Importaverage" 
                    ReadOnly="True" SortExpression="Importaverage" />
                <asp:BoundField DataField="Funaverage" HeaderText="Funaverage" ReadOnly="True" 
                    SortExpression="Funaverage" />
                <asp:BoundField DataField="Overaverage" HeaderText="Overaverage" 
                    ReadOnly="True" SortExpression="Overaverage" />
            </Fields>
        </asp:DetailsView>
        <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetAverages" 
            TypeName="DataSetTableAdapters.AverageScoresTableAdapter">
            <SelectParameters>
                <asp:CookieParameter CookieName="classname" DefaultValue="cs4960" 
                    Name="classname" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
  </ContentTemplate>
    </asp:UpdatePanel>

    </asp:Content>
<asp:Content ID="Content1" runat="server" contentplaceholderid="head">

    <style type="text/css">
        .style3
        {
            font-weight: bold;
        }
    </style>

</asp:Content>

